package com.grq.mis.config;

import cn.hutool.core.io.FileUtil;
import com.grq.mis.redis.RedisDao;
import lombok.extern.slf4j.Slf4j;
import org.beetl.core.GroupTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Map;

@Slf4j
@Component
@Order(1)
public class AppConfig implements CommandLineRunner {

    @Value("${app.name}")
    private String appName;
    @Value("${app.version}")
    private String appVersion;

    @Autowired
    private GroupTemplate groupTemplate;
    @Autowired
    private RedisDao redisDao;

    @Override
    public void run(String... args) throws Exception {

        Map<String, Object> shares = groupTemplate.getSharedVars();
        shares.put("appName", appName);
        shares.put("appVersion", appVersion);
        log.info(appName +" "+ appVersion + " 启动成功");

    }
}
